package Decorator;

interface Hero{
    void learnSilll();
}

class BlinkMonk implements Hero{

    private String sName ;
    public BlinkMonk(String name){
        this.sName = name;
    }

    @Override
    public void learnSilll() {
        System.out.println(sName + "learn all skills");
    }
}

class Skill implements Hero{
    protected Hero hero;

    public Skill(Hero hero){
        this.hero = hero;
    }

    @Override
    public void learnSilll() {
        if (hero!=null){
            hero.learnSilll();
        }
    }
}

class Skill_Q extends Skill{
    private String sSkillName;

    public Skill_Q(Hero hero,String sSkillName){
        super(hero);
        this.sSkillName = sSkillName;
    }

    @Override
    public void learnSilll() {
        System.out.println("LearnSkill:"+sSkillName);
        super.learnSilll();
    }
}

class Skill_W extends Skill{
    private String sSkillName;

    public Skill_W(Hero hero,String sSkillName){
        super(hero);
        this.sSkillName = sSkillName;
    }

    @Override
    public void learnSilll() {
        System.out.println("LearnSkill:"+sSkillName);
        super.learnSilll();
    }
}

class Skill_E extends Skill{
    private String sSkillName;

    public Skill_E(Hero hero,String sSkillName){
        super(hero);
        this.sSkillName = sSkillName;
    }

    @Override
    public void learnSilll() {
        System.out.println("LearnSkill:"+sSkillName);
        super.learnSilll();
    }
}

class Skill_R extends Skill{
    private String sSkillName;

    public Skill_R(Hero hero,String sSkillName){
        super(hero);
        this.sSkillName = sSkillName;
    }

    @Override
    public void learnSilll() {
        System.out.println("LearnSkill:"+sSkillName);
        super.learnSilll();
    }
}

public class HeroDemo {
    public static void main(String[] args){
        Hero BlindMonk = new BlinkMonk("liqing");

        Skill skill = new Skill(BlindMonk);
        Skill_Q skill_q = new Skill_Q(skill,"q skill");
        Skill_E skill_e = new Skill_E(skill_q,"e skill");
        Skill_R skill_r = new Skill_R(skill_e,"R skill");
        Skill_W skill_w = new Skill_W(skill_r,"W skill");

        skill_e.learnSilll();
    }
}

